<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var reg = /^123$/;  //^表示开头，$表示结尾，两个符号之间是匹配的内容
        // var str = "012345";
        // console.log(reg.test(str));
        var reg = /^[a-zA-Z0-9\_]{5,12}\@[a-zA-Z0-9]{2,5}\.com$/; 
        var str = "test123@qq.com";    //邮箱  
        console.log(reg.exec(str));
    </script>
</body>
</html>